// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
import store from './store'
import util from './util/index'
import 'element-ui/lib/theme-chalk/base.css';
import VCharts from 'v-charts-v2'
// collapse 展开折叠
import CollapseTransition from 'element-ui/lib/transitions/collapse-transition';


Vue.component(CollapseTransition.name, CollapseTransition)

Vue.prototype.util = util
Vue.config.productionTip = false
Vue.use(ElementUI);
Vue.use(VCharts)
axios.defaults.withCredentials = true
let index = 1;
router.beforeEach((to, from, next) => {
  let flag = store.state.editableTabs.filter(item => {
    return item.title == to.name;
  })
  if (flag.length == 0) {
    store.state.editableTabs.push({
      title: to.name,
      route: to.path,
      index: index++
    })
  }
  next()
})


/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  components: { App },
  template: '<App/>'
})
